package com.yourname.myapplication.ieportQuestions

import com.yourname.myapplication.network.api.QuestionApi
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

object RetrofitInstance {
    private const val BASE_URL = "https://example.com/api/"

    private val retrofit by lazy {
        Retrofit.Builder()
            .baseUrl(BASE_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .build()
    }

    val questionApi: QuestionApi by lazy {
        retrofit.create(QuestionApi::class.java)
    }
}

suspend fun fetchQuestions() {
    val api = RetrofitInstance.questionApi
    val questions = api.getQuestions()
    // 将获取到的 questions 存储到本地数据库或内存中
}